package com.yunmai.library.util;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * @author True Lies
 *
 * 提供View的公共访问Api
 *
 * Created by Coding on 2018/4/17.
 */

public class ViewUtil {

  /**
   * @param context
   * @return LayoutInflater
   */
  public static LayoutInflater getLayoutInflater(Context context){
    return LayoutInflater.from(context);
  }

  /**
   * 根据res返回View
   * @param context
   * @return View
   */
  public static View getLayoutInflater(Context context, ViewGroup viewGroup, int res){
    return getLayoutInflater(context, viewGroup, res , false);
  }


  /**
   * 根据res返回View
   * @param context
   * @return View
   */
  public static View getLayoutInflater(Context context, ViewGroup viewGroup, int res, boolean root){
    LayoutInflater layoutInflater = LayoutInflater.from(context);
    return layoutInflater.inflate(res, viewGroup, root);
  }



}
